<?php


namespace app\admin\controller;

/**
 * Created by PhpStorm
 * USER zhangkai QQ 920062039
 * Date 2022/2/17   16:58
 */
class Role extends ControllerBase
{

    /**
     * @OA\Get(
     *   tags={"角色"},
     *   path="/role/getList",
     *   summary="获取列表",
     *   @OA\Response(
     *     @OA\MediaType( mediaType="application/json"),
     *     response=200,
     *     description="返回列表"
     *   )
     * )
     */
    public function getList(){
        return result()->data($this->logicRole->getList(request()->param()))->toJson();
    }

    /**
     * @OA\Post(
     *   tags={"角色"},
     *   path="/role/add",
     *   summary="新增",
     *   @OA\Response(
     *     @OA\MediaType( mediaType="application/json"),
     *     response=200,
     *     description=""
     *   )
     * )
     */
    public function add(){
        return result()->data($this->logicRole->add(request()->param()))->toJson();
    }

    /**
     * @OA\Patch(
     *   tags={"角色"},
     *   path="/role/update",
     *   summary="更新",
     *   @OA\Response(
     *     @OA\MediaType( mediaType="application/json"),
     *     response=200,
     *     description=""
     *   )
     * )
     */
    public function update(){
        return result()->data($this->logicRole->update(request()->param()))->toJson();
    }

    /**
     * @OA\Delete (
     *   tags={"角色"},
     *   path="/role/del",
     *   summary="删除",
     *   @OA\Response(
     *     @OA\MediaType( mediaType="application/json"),
     *     response=200,
     *     description=""
     *   )
     * )
     */
    public function del(){
        return result()->data($this->logicRole->del(request()->param()))->toJson();
    }

    /**
     * @OA\Get(
     *   tags={"角色"},
     *   path="/role/getOption",
     *   summary="获取选项列表",
     *   @OA\Response(
     *     @OA\MediaType( mediaType="application/json"),
     *     response=200,
     *     description=""
     *   )
     * )
     */
    public function getOption(){
        return result()->data($this->logicRole->getOption(request()->param()))->toJson();
    }
}